import { CHANGE_ACTIVE, SAVE_CHANNELS } from '../actions/channel'

// 频道模块 初始值
const initState = {
  list: [],
  active: 0,
}

// 频道模块 reducer
export default function channelReducer(state = initState, action) {
  switch (action.type) {
    case SAVE_CHANNELS:
      return { ...state, list: action.payload }
    case CHANGE_ACTIVE:
      return { ...state, active: action.payload }
    default:
      return state
  }
}
